package edu.nctu.csie.jichang.database.command;

import edu.nctu.csie.jichang.database.model.cell.DBDatabase;
import edu.nctu.csie.jichang.database.model.cell.DBSchema;

public class FilterCommand implements IDBCommand {

	private DBDatabase element1 = null;
	private String[] pFilterTable = null;

	public DBDatabase execute() {
		for(DBSchema db : element1.getAllSchema()){
			for(String name : pFilterTable){
				if(db.hasTable(name)){
					db.removeTable(name);
				}
			}
		}
		return element1;
	}

	public void setOperand(DBDatabase pElement1, DBDatabase pElement2) {
		element1 = pElement1;
	}
	
	public void setArgument(String pArg) {
		pFilterTable = pArg.split(";");
	}
}
